home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: giuliano@ix.netcom.com(Giuliano Carlini)
- Newsgroups: comp.lang.c++
- Subject: Re: NEED HELP WITH ABSOLUTE ADDRESSING
- Date: 19 Apr 1996 18:20:56 GMT
- Organization: Netcom
- Message-ID: <4l8li8$f5p@dfw-ixnews4.ix.netcom.com>
- References: <4l6gnp$38c@janus.cqu.edu.au>
- NNTP-Posting-Host: lbx-ca7-26.ix.netcom.com
- X-NETCOM-Date: Fri Apr 19 1:20:56 PM CDT 1996
-
- In <4l6gnp$38c@janus.cqu.edu.au> Mutchg@Topaz.Cqu.Edu.Au (G.D.Mutch)
- writes:
- >
- >Please !
- >Can Anyone tell me how to assign an absolute address to a variable,
- >or get the variable to point to 0x378 ?
-
- Either:
- long* lptPortPtr = (long*)0x378;
- long& lptPortRef = *(long*)0x378;
-
- *lptPortPtr = 0;
- lptPortRef = 0;
- Will associate lptPortPtr and lptPortRef with address 0x378. But, it
- may not be the lpt port. Under dos it will be. But, under Win16 or
- Win32 it won't be. It has to do with the x86 addressing; a book on the
- 386 architecture will explain why. Briefly, in "protected mode" the
- addresses your program works with are "linear" addresses. These are not
- the same as "physical" addresses. The real printer port is at physical
- address 0x386. To get to it, you'll need to do something more
- complicated. Under Win16, you can use DPMI to get the linear address
- for physical address 0x386, or possibly use one of the selector's which
- Win16 exports. Your best bet under Win3.x, Win95, or WinNT is to write
- a device driver.
-
- g
-